<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace app\home\controller;

/**
 * Description of BaseController
 *
 * @author Administrator
 */
use think\Controller;
use think\Db;
class BaseController extends Controller{ 
    protected $userinfo = null;
    public function __construct() {
        parent::__construct();
        if(!$this->is_login()){
            return json(['code'=>0,'msg'=>'请登录系统']);
        }
    }
    
    /**
     * 验证登录
     */
    protected function is_login(){
        $user = session('userinfo');
        if(empty($user)){
            return false;
        }
        $this->userinfo = $user;
        return true;
    }
}
